exports.updateNoticeReadStatus = (req, res) => {

    //获取参数信息
    var bodyParams = req.routeInfo.bodyParams;

    var waitingUpdate = 0;

    //查询当前用户所有未读取消息
    function searchUnreadNotice(cb) {

        R.SEND_HTTP(
            req,
            res,
            {
                url: CORE_APIConfig.coreAPI.noticeSearch.Request_Api_Url + "/on_is_delete/0/on_is_read/0/on_receiver_id/" + bodyParams.on_receiver_id,
                method: 'POST',
                data: {
                    fields: ["on_id"].join(",")
                }
            },
            function (data) {

                waitingUpdate = data.result.data;
                cb();

            }
        )
    }

    //将未读消息状态更改为已读
    function updateUnreadNoticeReadStatus(cb) {

        F.SerialEach(waitingUpdate,function(item,index,callback){
            R.SEND_HTTP(
                req,
                res,
                {
                    url: CORE_APIConfig.coreAPI.noticeUpdate.Request_Api_Url,
                    method: 'POST',
                    data: {
                        update_where:"on_id",
                        on_id:item.on_id,
                        on_is_read:1,
                    }
                },
                function (data) {
                    if(data.success){
                        console.log("第"+(index+1)+"条消息已读");
                    }else{
                        callback();
                    }
                    callback();
                }
            )
        },cb);
    }
    F.Serial([searchUnreadNotice,updateUnreadNoticeReadStatus], () => {
        RES.successResponse(res);
    })
}